﻿@model IEnumerable<sBlog.Net.Domain.Entities.PostEntity>
<script type="text/javascript">
    $(document).ready(function () {
        var height = $('#blockB a').height();
        var timeout = 0;

        function nextA() {
            clearTimeout(timeout);

            $('#blockB').css({ bottom: 0 });
            $('#blockB').animate({ bottom: -height }, 600);
            $('#blockB a:last-child').prependTo('#blockB');

            $('#blockC').css({ bottom: 0 });
            $('#blockC').animate({ bottom: -height }, 600);
            $('#blockC a:last-child').prependTo('#blockC');

            $myclone = $('#blockB a:last-child').clone();
            $mytxt = $('#blockC a:last-child').clone();
            $myhref = $myclone.attr('href');

            var image_manipulation = $myclone.html();

            $big_image = image_manipulation.replace(/110x120_/, '720x400_');
            $big_image = $big_image + "<div class = 'dvBoxItem'><div class = 'dvBoxItemText'><a href='" + $myclone.attr('href') + "'>" + $mytxt.html() + "</a>";
            $big_image = $big_image + "<br /><span class='dvTeaserHome'>" + $myclone.attr('rel') + "</span></div></div>";

            $('#blockA a').html($big_image);
            $('#blockA img').removeClass("min").addClass("max");
            $('#blockA img').css({ opacity: 0 })

    .animate({ opacity: 1 }, 600);

            timeout = setTimeout(function () {
                nextA();
            }, 5000);
        }
        nextA();
    });
</script>
@if (Model.Count() == 0)
{
    <div>
        there are no posts in the page entered.</div>
}
<div id="block-itunes">
    @{int intSTT = 0;}
    <div id="blockA">
        <a href="#"></a>
    </div>
    <div id="itune_images">
        <div id="blockB">
            @foreach (var post in Model)
            {
                var url = Url.RouteUrl("IndividualPost", new { year = post.PostYear, month = post.PostMonth, url = post.PostUrl, status = string.Empty });
                     
                <a href="@url" rel="">
                    <img src="@Url.Content("http://s1.img.yan.vn/Mlog/UploadThumbs/110x120_" + post.PostAvatar)" width="110" height="120" class="min" alt="Avatar" />
                </a>
                intSTT++;
            }
        </div>
    </div>
    <div id="itune_title">
        <div id="blockC">
            @{intSTT = 0;}
            @foreach (var post in Model)
            {
                var urlTitle = Url.RouteUrl("IndividualPost", new { year = post.PostYear, month = post.PostMonth, url = post.PostUrl, status = string.Empty });
                <a href="@urlTitle">@post.PostTitle</a>
                intSTT++;
            }
        </div>
    </div>
</div>
